﻿$("#save").click(function () {
    var index = layer.load(2, { shade: [0.1, '#fff'] });
    var encrypt = new JSEncrypt();
    encrypt.setPublicKey($("#publicKey").val());
    var encryptedPass = encrypt.encrypt($('#Password').val());
    $.ajax({
        url: "/Login/Login",
        type: "post",
        data: { "UserName": $("#UserName").val(), "Password": encryptedPass, "VerifyCode": $("#VerifyCodeInput").val()},
        success: function (e) {
            if (e.status == 1) {
                parent.layer.msg(e.msg, {icon:1});
                window.location.href = "/Home/Index";
            } else {
                $("#VerifyCode").attr("src", "/Login/VerifyCode?v=" + Math.random());
                layer.msg(e.msg, { icon: 2 });
                layer.close(index);
            }
        }
    });
});